<!-- 头部 -->
<include file="Public:header" />

        <div class="index-wrapper" style="padding-bottom: 1px;">
            <!-- banner-section start -->
            <?php if ($faqiinfo['fq_sf'] ==2) { ?>
              <div class="banner-section" style="background: #fff;height: 160px;">
                  <img id="LAY_demo_uploadz" src="<?php if ($faqiinfo['imgs']) { ?> __ROOT__{$faqiinfo['imgs']}<?php }else { ?>__PUBLIC__/home/images/qt/xx.png<?php }?>" alt="" style="width: 100%;height: 160px;">
                  <div style="height: 90px;width: 90px;background: #fff;position: absolute;top: 20px;left: 36%;border-radius: 50%;opacity: 0.8;">
                      <div style="margin-left: 25px;height: 95px;"><span style="font-size: 40px;position: relative;left: 9px;top: 25px;">+</span></div>
                      <style type="text/css">.site-demo-upbar .layui-upload-button{height: 70px;}</style>
                      <div class="site-demo-upbar" style="position: absolute;top: 15px;opacity: 0;">
                          <input type="file" name="file" class="layui-upload-file" id="imgs">
                      </div>
                      <p style="font-size: 13px;color:#fff;padding-left: 8px;">添加学校图片</p>
                  </div>
              </div>
            <?php }elseif ($faqiinfo['fq_sf'] == 3) { ?>
              <div class="banner-section" style="background: #fff;height: 160px;">
                  <img id="LAY_demo_uploadz" src="<?php if ($faqiinfo['imgs']) { ?> __ROOT__{$faqiinfo['imgs']}<?php }else { ?>__PUBLIC__/home/images/qt/xx.png<?php }?>" alt="" style="width: 100%;height: 160px;">
                  <div style="height: 90px;width: 90px;background: #fff;position: absolute;top: 20px;left: 36%;border-radius: 50%;opacity: 0.8;">
                      <div style="margin-left: 25px;height: 95px;"><span style="font-size: 40px;position: relative;left: 9px;top: 25px;">+</span></div>
                      <style type="text/css">.site-demo-upbar .layui-upload-button{height: 70px;}</style>
                      <div class="site-demo-upbar" style="position: absolute;top: 15px;opacity: 0;">
                          <input type="file" name="file" class="layui-upload-file" id="imgs">
                      </div>
                      <p style="font-size: 13px;color:#fff;padding-left: 8px;">添加公司图片</p>
                  </div>
              </div>
            <?php }elseif ($faqiinfo['fq_sf'] == 4) { ?>
              <div class="banner-section" style="background: #fff;height: 160px;">
                  <img id="LAY_demo_uploadz" src="<?php if ($faqiinfo['imgs']) { ?> __ROOT__{$faqiinfo['imgs']}<?php }else { ?>__PUBLIC__/home/images/qt/xx.png<?php }?>" alt="" style="width: 100%;height: 160px;">
                  <div style="height: 90px;width: 90px;background: #fff;position: absolute;top: 20px;left: 36%;border-radius: 50%;opacity: 0.8;">
                      <div style="margin-left: 25px;height: 95px;"><span style="font-size: 40px;position: relative;left: 9px;top: 25px;">+</span></div>
                      <style type="text/css">.site-demo-upbar .layui-upload-button{height: 70px;}</style>
                      <div class="site-demo-upbar" style="position: absolute;top: 15px;opacity: 0;">
                          <input type="file" name="file" class="layui-upload-file" id="imgs">
                      </div>
                      <p style="font-size: 13px;color:#fff;padding-left: 8px;">添加慈善图片</p>
                  </div>
              </div>
            <?php }else { ?>
              <div class="banner-section" style="height:240px;background: #fff;">
                  <div style="height: 145px;background: #fff;"><div style="width: 100%;height: 160px;background: #FF8711;"></div></div>
                  <img src="__ROOT__/{$faqiinfo.face}" style="border-radius: 50%;position: relative;left: 36%;top: -60px;width: 110px;;">
                  <p style="font-size: 16px;text-align: center;position: relative;top: -50px;">{$faqiinfo['name']}邀你一起献爱心</p>
              </div>
            <?php } ?>
            <!-- banner-section end -->
            <form class="layui-form" method="post" style="background: #fff;">
            <?php if ($faqiinfo['fq_sf'] ==2) { ?>
              <div style="background: #fff;height:90px">
                  <div style="padding: 5px 20px">
                      <span style="font-weight: bold;">学校名称 :</span> <span>(12字内)</span>
                      <input type="text" name="school" placeholder="学校名称" value="{$faqiinfo['school']}" style="padding: 10px 20px;border: 1px solid #E6E5E3;color: #FF8711;width: 98%;margin-top: 15px;">
                  </div>
              </div>
            <?php }elseif ($faqiinfo['fq_sf'] == 3) { ?>
              <div style="background: #fff;height:90px">
                  <div style="padding: 5px 20px">
                      <span style="font-weight: bold;">公司名称 :</span> <span>(12字内)</span>
                      <input type="text" name="school" placeholder="公司名称" value="{$faqiinfo['school']}" style="padding: 10px 20px;border: 1px solid #E6E5E3;color: #FF8711;width: 98%;margin-top: 15px;">
                  </div>
              </div>
            <?php }elseif ($faqiinfo['fq_sf'] == 4) { ?>
              <div style="background: #fff;height:90px">
                  <div style="padding: 5px 20px">
                      <span style="font-weight: bold;">慈善组织名称 :</span> <span>(12字内)</span>
                      <input type="text" name="school" placeholder="慈善组织名称" value="{$faqiinfo['school']}" style="padding: 10px 20px;border: 1px solid #E6E5E3;color: #FF8711;width: 98%;margin-top: 15px;">
                  </div>
              </div>
            <?php }else { ?>
            <?php } ?>
              <div style="background: #fff;">
                  <div style="padding: 20px;">
                      <span style="font-weight: bold;">选择目标：</span>
                      <div class="layui-input-block" style="margin:20px 1px;">
                        <p id="szmb">
                          <span zhi="0" style="padding: 5px 1px;border: 1px solid #B7B7B7;color: #B7B7B7;width: 28%;display: -webkit-inline-box;">不设目标</span>&nbsp;
                          <span zhi="50" style="padding: 5px 1px;border: 1px solid #B7B7B7;color: #B7B7B7;width: 19%;display: -webkit-inline-box;">50(本)</span>&nbsp;
                          <span zhi="100" style="padding: 5px 1px;border: 1px solid #B7B7B7;color: #B7B7B7;width: 22%;display: -webkit-inline-box;">100(本)</span>&nbsp;
                          <span zhi="200" style="padding: 5px 1px;border: 1px solid #B7B7B7;color: #B7B7B7;width: 22%;display: -webkit-inline-box;">200(本)</span>
                        </p>

                        <input id="mubiao" type="text" name="mubiao" placeholder="自订目标(本)" style="padding: 12px 20px;border: 1px solid #E6E5E3;color: #FF8711;width: 98%;margin-top: 15px;" value="{$faqiinfo.mubiao}">
                      </div>
                  </div>
              </div>            
              <div style="background: #fff;height:120px">
                  <div style="padding: 1px 20px">
                      <span style="font-weight: bold;">写个吸引小伙伴的口号 :</span> <span>(100字内)</span>
                      <textarea name="msg" lay-verify="msg" cols="30" rows="5" style="width: 100%;background: #FAFAFA;border: 0px;color: #A9A9A9;" placeholder="我们今天播下善的种子,明天我们将在爱的森林里重逢。">{$faqiinfo.msg}</textarea>
                  </div>
              </div>
              <!-- 项目信息 -->
              <div style="padding-bottom: 20px">
                  <div style="width: 90%;height: 165px;text-align: center;margin: 0 auto;box-shadow: 1px 1px 15px #EDEDED;border-radius: 5px;">
                  <a href="{:U('index/xm',array('id'=>$xminfo['id']))}">
                      <p style="font-size: 18px;font-weight: bold;padding: 5px;">{$xminfo.xm_name}</p>
                      <div style="float: left;padding-left: 20px;"><img src="__ROOT__{$xminfo.xm_img}" alt="" style="height: 100px;border-radius: 5px;"></div>
                      <div style="padding-left: 160px;text-align: left;">
                          <p style="font-size: 13px;padding-bottom: 5px;">{$xminfo.xm_content}</p>
                          <p style="font-size: 14px;padding-bottom: 5px;">善物接收：{$xminfo.organ}</p>
                          <p style="font-size: 14px;padding-bottom: 5px;">总目标：<font color="#FF8711">{$xminfo.xm_mubiao}</font>本</p>
                          <p style="font-size: 14px;padding-bottom: 5px;">已筹物：<font color="#FF8711">{$xminfo.xm_num}</font>本</p>
                      </div>
                      <span style="color:#FF8711;margin-left: -50px;">查看详情</span>
                  </a>
                  </div>
              </div>

              <p style="text-align: center;">
                  <input type="hidden" name="id" value="{$faqiinfo.id}">
                  <input type="hidden" name="fq_sf" value="{$faqiinfo.fq_sf}">
                  <button lay-submit="" lay-filter="*" style="width: 100%;padding: 20px;background: #FF8711;color: #fff;border: 0px;font-size: 18px;">确认修改</button>
              </p>
            </form>
        </div>

<script type="text/javascript">
    layui.use(['form','layer','upload'], function(){
       $ = layui.jquery;
      var layer = layui.layer
      ,form = layui.form();
      //layer.msg('Hello World');

    $("#szmb span").click(function(){
        var o = $(this);
        //alert(o.attr("id"));
        $(this).css('border','1px solid #FF8711').css('color','#FF8711').siblings().css('border','1px solid #B7B7B7').css('color','#B7B7B7');
        $("#mubiao").attr('value',o.attr("zhi"));
    });

    layui.upload({
        url: '{:U("faqi/editimgs",["id"=>$faqiinfo["id"]])}' //上传接口
        ,elem: '#imgs' //指定原始元素，默认直接查找class="layui-upload-file"
        ,success: function(res){ //上传成功后的回调
          //console.log(res)
          //location.reload();
          LAY_demo_uploadz.src = res.data.src;
        }
    });

    //交互
    form.on('submit(*)', function(data){
        $.ajax({
            url: "{:U('faqi/edit')}",//请求地址
            type: "post",//请求方式
            dataType: "json",//返回数据类型
            data: data.field,//发送的参数
            })
            .done(function(response) {
                  if(response.error==0){
                     layer.msg(response.info ,{icon:5});
                  }else{
                     //layer.msg(response.info ,{icon:6});
                     location.href = response.url;
                  }
              })
            .fail(function() {
                alert("ajxs交互失败");
            })  

          return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });   
    });

</script>



    </body>
</html>
